<template>
    <div class="tab-bar">
        <slot></slot>
    </div>
</template>
<script setup>
import { reactive, provide, defineProps, defineEmits } from "vue";
const props = defineProps({
    modelValue: {
        type: Number,
        default: 0,
    },
});
const emit = defineEmits(["update:modelValue"]);

const setActive = (index) => {
    emit("update:modelValue", index);
};

const children = reactive([]);
provide('TabBar',{
    children,
    link:(child)=>{
        if(child){
            children.push(child);
        }
    },
    setActive,
    props,
})
</script>
<style scoped>
.tab-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    font-size: 12px;
    background: linear-gradient(45deg, #4897ec 20%, #f13de8 80%);
    border-bottom: 1px solid #ccc;
    box-shadow: 0px -1px 3px rgba(0, 0, 0, 0.3);
}
</style>
